import Vue from 'vue'
import App from './App.vue'
import router from './router'
import axios from 'axios'
import ElementUI, { Message } from 'element-ui'

import 'element-ui/lib/theme-chalk/index.css'
import './style/index.css'
// import { quillEditor, Quill } from 'vue-quill-editor'
// import { ImageExtend, QuillWatch } from 'quill-image-extend-module'

// import 'quill/dist/quill.core.css'
// import 'quill/dist/quill.snow.css'
// import 'quill/dist/quill.bubble.css'
import store from './store'

import mavonEditor from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'
// use
Vue.use(mavonEditor)
Vue.config.productionTip = false
axios.defaults.baseURL = '/api/private/v1'
axios.interceptors.request.use(
  function (config) {
    const token = window.sessionStorage.getItem('token')
    config.headers.Authorization = token
    return config
  }
)

axios.interceptors.response.use((config) => {
  if (config.data.code !== 200 && config.data.code !== 0) {
    Message.error(config.data.message)
  }
  return config
})
// Vue.use(quillEditor)

Vue.use(ElementUI)

Vue.prototype.$http = axios

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
